package com.dayuanit.dy15.atm.controller;

import com.dayuanit.dy15.atm.dto.FlowDto;
import com.dayuanit.dy15.atm.dto.ResponseDTO;
import com.dayuanit.dy15.atm.entity.AtmFlow;
import com.dayuanit.dy15.atm.service.AtmFlowService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * (AtmFlow)表控制层
 *
 * @author makejava
 * @since 2020-05-23 11:48:32
 */
@RestController
public class AtmFlowController extends BaseController{
    /**
     * 服务对象
     */
    @Resource
    private AtmFlowService flowService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public AtmFlow selectOne(Long id) {
        return this.flowService.queryById(id);
    }

    @GetMapping("/flow/loadTop10")
    public ResponseDTO loadTop10(HttpServletRequest request) {
        List<FlowDto> flowList = flowService.listTop10(getUserId(request));
        return ResponseDTO.success().data("flowList",flowList);
    }

}
